home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / lang / BCPL4Amiga.lha / tripos / hello.c < prev    next >
C/C++ Source or Header  |  1988-12-06  |  2KB  |  51 lines

  1. /* hello.c - an example of calling the BCPL library from C
  2. Compile and link with Manx 3.4:
  3.   cc hello
  4.   ln hello.o bcpllib.o -lc
  5. Author: Bill Kinnersley
  6. Date: Mar 12, 1988
  7. Mail:   Physics Dept.
  8.         Montana State University
  9.         Bozeman, MT 59717
  10.         BITNET: iphwk@mtsunix1
  11.         INTERNET: iphwk%mtsunix1.bitnet@cunyvm.cuny.edu
  12.         UUCP: ...psuvax1!mtsunix1.bitnet!iphwk
  13. */
  14. #include <stdio.h>
  15. #include <exec/memory.h>
  16. #include <libraries/dosextens.h>
  17. #include "bcpl.h"
  18.  
  19. void *AllocMem();
  20. extern long *a;
  21.  
  22. main() {
  23.         long proc, root, n, num;
  24.         struct Process *mytask;
  25.         char *s, *t, *buf;
  26.         BPTR bs, bt;
  27.  
  28.         BCPLInit();
  29.  
  30.         /*s = "Not is the time"; t = "NoT is the time";
  31.         bs = MakeBSTR(s); bt = MakeBSTR(t); num = BCPL(STRCMP,bs,bt);
  32.         printf("returned %ld\n",num); FreeBSTR(bs); FreeBSTR(bt);*/
  33.  
  34.         proc = BCPL(FINDTASK); printf("My CLI Process is at %lx\n",proc);
  35.         root = BCPL(FINDROOT); printf("The root is at %lx\n", root);
  36.  
  37.         s = "Here's a tab:%T5, a signed:%N, and an unsigned:%U8\n";
  38.         bs = MakeBSTR(s);
  39.         BCPL(WRITEF, bs, -1L, -1L); BCPL(NEWLINE);
  40.         FreeBSTR(bs);
  41.  
  42.         /*num = BCPL(RDCH); num = BCPL(RDCH); BCPL(WRCH,num);BCPL(NEWLINE);*/
  43.         /*buf = (char *)AllocMem(80L,MEMF_PUBLIC);
  44.         num = BCPL(READIN,bptr(buf),80L);
  45.         BCPL(WRITEOUTB,bptr(buf),num); FreeMem(buf,80L);*/
  46.         /*num = BCPL(READN); printf("num=%ld\n",num);*/
  47.         /*n = BCPL(MOD, 23L, 5L); printf("n=%ld\n", n);*/
  48.  
  49.         BCPLQuit();
  50. }
  51.